﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Controls;
using System.Windows;

namespace PlaceOrder_Server.Styles
{
    public class RowStyleSelector : StyleSelector
    {
        public Style OnlineRowStyle { get; set; } // 在线状态的行样式
        public Style OfflineRowStyle { get; set; } // 离线状态的行样式

        public override Style SelectStyle(object item, DependencyObject container)
        {
            DataRow row = item as DataRow;
            if (row != null)
            {
                int status = (int)row["Status"]; // 假设 "Status" 是表示状态的列名
                return status == 1 ? OnlineRowStyle : OfflineRowStyle; // 根据状态选择行样式
            }
            return base.SelectStyle(item, container);
        }
    }

}
